<%-- 
    Document   : Error
    Created on : 09-20-2011, 01:57:32 PM
    Author     : 43579648
--%>

<%@page import="org.reporte.utils.JsfAyuda"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page isErrorPage="true" %>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title><%=JsfAyuda.getPropertyValue("paginaErrorTitulo",request.getLocale())%></title>
    </head>
    <body>
        <h1><%=JsfAyuda.getPropertyValue("paginaErrorEnunciado",request.getLocale())%></h1>
        <p>
            <%=JsfAyuda.getPropertyValue("paginaErrorInformacion",request.getLocale())%>
        </p>
        <br/>
        <font color="red">
	<%= exception.toString() %><br>
        </font>
        <br/>
        <%=JsfAyuda.getPropertyValue("paginaErrorParrafo",request.getLocale())%>
        
        <textarea rows="20" cols="160">
        <% if (exception != null) {
            //Validando la sesión del usuario
            if(exception.toString().contains("javax.faces.application.ViewExpiredException")||
               exception.toString().contains("java.lang.IndexOutOfBoundsException")
               ){ //Si la sesion ha expirado
                String ctxPath =request.getContextPath();
                String urlPattern=JsfAyuda.getPropertyValueFromConfigurationFile("moduloUrlPatern");
                String redirect= "";
                if(urlPattern.startsWith("*")){
                    redirect=ctxPath+"/informacion/SesionExpirado"+urlPattern.replace("*", "");
                }else if(urlPattern.endsWith("*")){
                    redirect=ctxPath+urlPattern.replace("*", "")+"/informacion/SesionExpirado.xhtml";
                }
                response.sendRedirect(redirect); //Redirecciona a la pagina de sesion expirado
            }else{ //Sino otra excepcion
                //Pintando la excepcion
                exception.printStackTrace(new java.io.PrintWriter(out));
            }
         }else{//Si la excepcion es nula
            out.println(JsfAyuda.getPropertyValue("paginaErrorParrafoNoExeption",request.getLocale()));
        }%>
        </textarea>
    </body>
</html>
